package hiq.math.complex;

public class ComplexActions {

	/**
	 * Multiplication of two complex numbers
	 * 
	 * @param a
	 * @param b
	 * @return
	 */
	public static Complex mult(Complex a, Complex b) {
		return Complex.create(a.re * b.re - a.im * b.im, a.re * b.im + a.im
				* b.re);
	}

	/**
	 * Sum of two complex numbers
	 * 
	 * @param a
	 * @param b
	 * @return
	 */
	public static Complex sum(Complex a, Complex b) {
		return Complex.create(a.re + b.re, a.im + b.im);
	}

	/**
	 * Difference of two complex numbers
	 * 
	 * @param a
	 * @param b
	 * @return
	 */
	public static Complex diff(Complex a, Complex b) {
		return Complex.create(a.re - b.re, a.im - b.im);
	}

	/**
	 * Power.
	 * 
	 * @param c
	 * @param power
	 * @return
	 */
	public static Complex pow(Complex c, int power) {

		double abs = Math.pow(c.abs(), power);
		double arg = c.arg() * power;

		return Complex.expCreate(abs, arg);
	}

}
